Conditions | 1 |
Total Lines | 75 |
Code Lines | 66 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | import React, { Component } from 'react'; |
||
85 | |||
86 | render() { |
||
87 | const chartData = { |
||
88 | ...this.state.chartData, |
||
89 | datasets: [ |
||
90 | { |
||
91 | ...this.state.chartData.datasets[0], |
||
92 | data: this.state.activeUserHistory |
||
93 | } |
||
94 | ] |
||
95 | }; |
||
96 | |||
97 | return ( |
||
98 | <Card className="h-100 bg-gradient"> |
||
99 | <CardHeader className="bg-transparent"> |
||
100 | <h5 className="text-white">Active users right now</h5> |
||
101 | <div className="real-time-user display-1 font-weight-normal text-white">{this.state.currentActiveUser}</div> |
||
102 | </CardHeader> |
||
103 | <CardBody className="text-white fs--1"> |
||
104 | <p className="pb-2" style={{ borderBottom: dividerBorder }}> |
||
105 | Page views per second |
||
106 | </p> |
||
107 | <Bar data={chartData} options={chartOptions} width={10} height={4} /> |
||
108 | <ListGroup flush className="mt-4"> |
||
109 | <ListGroupItem |
||
110 | className="bg-transparent d-flex justify-content-between px-0 py-1 font-weight-semi-bold border-top-0" |
||
111 | style={{ borderColor: listItemBorderColor }} |
||
112 | > |
||
113 | <p className="mb-0">Top Active Pages</p> |
||
114 | <p className="mb-0">Active Users</p> |
||
115 | </ListGroupItem> |
||
116 | <ListGroupItem |
||
117 | className="bg-transparent d-flex justify-content-between px-0 py-1" |
||
118 | style={{ borderColor: listItemBorderColor }} |
||
119 | > |
||
120 | <p className="mb-0">/bootstrap-themes/</p> |
||
121 | <p className="mb-0">3</p> |
||
122 | </ListGroupItem> |
||
123 | <ListGroupItem |
||
124 | className="bg-transparent d-flex justify-content-between px-0 py-1" |
||
125 | style={{ borderColor: listItemBorderColor }} |
||
126 | > |
||
127 | <p className="mb-0">/tags/html5/</p> |
||
128 | <p className="mb-0">3</p> |
||
129 | </ListGroupItem> |
||
130 | <ListGroupItem |
||
131 | className="bg-transparent d-xxl-flex justify-content-between px-0 py-1 d-none" |
||
132 | style={{ borderColor: listItemBorderColor }} |
||
133 | > |
||
134 | <p className="mb-0">/</p> |
||
135 | <p className="mb-0">2</p> |
||
136 | </ListGroupItem> |
||
137 | <ListGroupItem |
||
138 | className="bg-transparent d-xxl-flex justify-content-between px-0 py-1 d-none" |
||
139 | style={{ borderColor: listItemBorderColor }} |
||
140 | > |
||
141 | <p className="mb-0">/preview/falcon/dashboard/</p> |
||
142 | <p className="mb-0">2</p> |
||
143 | </ListGroupItem> |
||
144 | <ListGroupItem |
||
145 | className="bg-transparent d-flex justify-content-between px-0 py-1" |
||
146 | style={{ borderColor: listItemBorderColor }} |
||
147 | > |
||
148 | <p className="mb-0">/100-best-themes...all-time/</p> |
||
149 | <p className="mb-0">1</p> |
||
150 | </ListGroupItem> |
||
151 | </ListGroup> |
||
152 | </CardBody> |
||
153 | <CardFooter className="text-right bg-transparent" style={{ borderTop: dividerBorder }}> |
||
154 | <Link className="text-white" to="#!"> |
||
155 | Real-time report |
||
156 | <FontAwesomeIcon icon="chevron-right" transform="down-1" className="ml-1 fs--1" /> |
||
157 | </Link> |
||
158 | </CardFooter> |
||
159 | </Card> |
||
160 | ); |
||
165 |